// component/classify/classify.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    shop: {
      type: Array,
      value: []
    },
    num: {
      type: Number
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },
  pageLifetimes: {

    show: function() {
      var that = this
      that.setData({
        type: that.properties.num
      })
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    shopdetail: function(e) {
      var that = this
      var sid = e.currentTarget.dataset.sid
      var sname = e.currentTarget.dataset.sname
      var sthumb = e.currentTarget.dataset.sthumb
      //清空数据
      if (that.data.type == 1) {
        console.log(that.data.type)
        var pages = getCurrentPages();
        var prevPage = pages[pages.length - 2];
        prevPage.setData({
          sid: sid,
          sname: sname,
          sthumb: sthumb
        })
        wx.navigateBack({
          detail: 1
        })
      } else {
        wx.navigateTo({
          url: '/hyb_yl/onesubpages/pages/shopdetail/shopdetail',
        })
      }
    },
  }
})